﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LibFriesland_Campina_CRM;

public partial class UserControls_UCSupSale : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            string by_sup = Request.Form["ctl00$ContentPlaceHolder1$cboSup"].ToString();
            string fromDate = Request.Form["ctl00$ContentPlaceHolder1$dtFromDate"].ToString();
            string toDate = Request.Form["ctl00$ContentPlaceHolder1$dtToDate"].ToString();

            DateTime dtFromDate = Convert.ToDateTime(Thuvien.myConvertStringToShortDate(fromDate));
            DateTime dtToDate = Convert.ToDateTime(Thuvien.myConvertStringToShortDate(toDate));

            LibFriesland_Campina_CRM.Dataset.DatasetSupSale ds = DalInvoiceDetail.getSalebyDateSup(dtFromDate, dtToDate, by_sup);
            LibFriesland_Campina_CRM.Report.ReportSupSale report = new LibFriesland_Campina_CRM.Report.ReportSupSale();
            
            report.SetDataSource(ds); //Gan nguon cho bao cao
            crvSupSale.ReportSource = report;
            crvSupSale.DataBind();
        }
        catch (Exception ex)
        {

        }
    }
}